Dynomotion

Group: DynoMotion Message: 866 From: ca_gray751 Date: 1/10/2011
Subject: IsMoving with Mach3 home routine.
To start the home sequence in mach3 I issues the following button script:

DoOEMButton(1024)
While IsMoving()
Sleep(50)
Wend
DoOEMButton(1007)
While IsMoving()
Sleep(50)
Wend
Message("Home complete")


The DROs never get zeroed and the message is displayed almost immediately, well before the home routine is actually completed. Even though the DROS are still moving, it appears that mach and the plugin are not communicating properly.
Group: DynoMotion Message: 869 From: Tom Kerekes Date: 1/11/2011
Subject: Re: IsMoving with Mach3 home routine.
Hi Allen,
 
I don't think the Mach3 function IsMoving() will work while homing because Mach3 isn't generating any motion it just launches the homing program in KFlop.    Homing requests are actually queued in the plugin and executed sequetially in a non-blocking manner to Mach3.  If you really need to know when the homing is finished you would need to impliment something like a flag that could be set at the end of your Homing routine in KFlop.  A virtual I/O bit could be used as a flag.  Other Users haven't found a need for this. The example below shows how it might be done.
 
Configure Mach3 Ports and Pins | Input#1 as virtual bit 48 (port 1 pin 48)
 
In your C homing program set the virtual bit when homing starts and clear it when finished
 
 if (flags==4)
 {
      SetBit(48);
      // do z homing here
      ClearBit(48);
 }
Then the Mach3 VB Script would be:
 
 
DoOEMButton(1024) ' Ref Z
sleep(1000) 'make sure homing started
While IsActive(INPUT1) 'wait for homing to finish
sleep(50)
Wend
sleep(1000) 'wait for Mach to re-synch

DoOEMButton(1007)'Zero Z
Message("Home Complete")
 
There might be better ways to do it to avoid the race conditions (need for delays), but I hope this helps.
 
Regards
TK

 

Group: DynoMotion Message: 870 From: ca_gray751 Date: 1/11/2011
Subject: Re: IsMoving with Mach3 home routine.
Thanks, that worked.


--- In DynoMotion@yahoogroups.com, Tom Kerekes <tk@...> wrote:
>
> Hi Allen,
>
> I don't think the Mach3 function IsMoving() will work while homing because Mach3
> isn't generating any motion it just launches the homing program in KFlop.   
> Homing requests are actually queued in the plugin and executed sequetially in a
> non-blocking manner to Mach3.  If you really need to know when the homing is
> finished you would need to impliment something like a flag that could be set at
> the end of your Homing routine in KFlop.  A virtual I/O bit could be used as a
> flag.  Other Users haven't found a need for this. The example below shows how it
> might be done.
>
> Configure Mach3 Ports and Pins | Input#1 as virtual bit 48 (port 1 pin 48)
>
> In your C homing program set the virtual bit when homing starts and clear it
> when finished
>
>  if (flags==4)
>  {
>       SetBit(48);
>       // do z homing here
>       ClearBit(48);
>  }
>
> Then the Mach3 VB Script would be:
>
>
> DoOEMButton(1024) ' Ref Z
> sleep(1000) 'make sure homing started
> While IsActive(INPUT1) 'wait for homing to finish
> sleep(50)
> Wend
> sleep(1000) 'wait for Mach to re-synch
>
> DoOEMButton(1007)'Zero Z
> Message("Home Complete")
>
>
> There might be better ways to do it to avoid the race conditions (need for
> delays), but I hope this helps.
>
> Regards
> TK
>
>  
>
>
>
> ________________________________
> From: ca_gray751 <agray@...>
> To: DynoMotion@yahoogroups.com
> Sent: Mon, January 10, 2011 1:56:17 PM
> Subject: [DynoMotion] IsMoving with Mach3 home routine.
>
>  
> To start the home sequence in mach3 I issues the following button script:
>
> DoOEMButton(1024)
> While IsMoving()
> Sleep(50)
> Wend
> DoOEMButton(1007)
> While IsMoving()
> Sleep(50)
> Wend
> Message("Home complete")
>
> The DROs never get zeroed and the message is displayed almost immediately, well
> before the home routine is actually completed. Even though the DROS are still
> moving, it appears that mach and the plugin are not communicating properly.
>